var express = require('express');
var router = express.Router();
var Post = require('../models/posts.js');
var check = require('./check');
var checkLogin = check['checkLogin'];
var checkNotLogin = check['checkNotLogin'];


router.post('/',checkLogin);
router.post('/',function(req,res,next){
    var postP = req.body;
    var post = new Post(postP);
    post.save(function(err){
        if (err) {
            res.json({success:false,message:"文章上传失败"});
        }else{
            res.json({success:true,message:"文章上传成功"});
        }
    });

});

module.exports = router;